import java.util.ArrayList;
import java.util.List;
public class Customer extends User {
    private String level; // 客户级别：金牌、银牌、铜牌
    private String phoneNumber;
    private String email;
    private List<String> shoppingHistory; // 购买历史
    private double totalAmountSpent;
    public Customer(String username, String password, String phoneNumber, String email) {
        super(username, password);
        this.level = "铜牌客户";
        this.phoneNumber = phoneNumber;
        this.email = email;
        this.shoppingHistory = new ArrayList<>();
        this.totalAmountSpent = 0.0;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public String getEmail() {
        return email;
    }

    public List<String> getShoppingHistory() {
        return shoppingHistory;
    }

    public double getTotalAmountSpent() {
        return totalAmountSpent;
    }
    public void addPurchase(String productName, double amount) {
        shoppingHistory.add(productName + " - ¥" + amount);
        totalAmountSpent += amount;
    }

    @Override
    public String toString() {
        return super.toString() + ", 级别: " + level + ", 手机号: " + phoneNumber + ", 邮箱: " + email + ", 累计消费: ¥" + totalAmountSpent;
    }
}